//
//  LoginHandle.m
//  JJHW_coreData
//
//  Created by lizhenqiang on 16/6/13.
//  Copyright © 2016年 HFKJ_LZQ. All rights reserved.
//

#import "LoginHandle.h"
#import "BaseNavigationController.h"
@implementation LoginHandle
+(BOOL)isHadLogin:(UIViewController *)VC
{
    Person *_person = [Person sharePerson];
    if (_person.isLogined) {
        return YES;
    }
    else
    {
        LoginViewController *login = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
        BaseNavigationController *nav = [[BaseNavigationController alloc] initWithRootViewController:login];
        [VC presentViewController:nav animated:YES completion:nil];
        return NO;
    }
}

+(void)isLogin:(loginCallBackBlock )successBlock failureBlock:(loginCallBackBlock)fblock andVC:(UIViewController *)VC
{
    Person *_person = [Person sharePerson];
    if (_person.isLogined) {
        if (successBlock) {
            successBlock();
        }
    }
    else
    {
        LoginViewController *login = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
        login.block = successBlock;
        login.failureBlock = fblock;
        BaseNavigationController *nav = [[BaseNavigationController alloc] initWithRootViewController:login];
        [VC presentViewController:nav animated:YES completion:nil];
    }
    
}
@end
